//
// Created by wkm on 2023-12-11.
//

#include "apply_and_check.h"

const int VECTOR_WIDTH = 13;
const int MAX_VECTORS = 3;

void apply_and_check::behavior() {
    sc_lv<VECTOR_WIDTH> in_vector[MAX_VECTORS];
    int index;
    sc_uint<WIDTH> expected;

    // 列出向量
    in_vector[0] = "1100000111101";
    in_vector[1] = "1000010111001";
    in_vector[2] = "0100010000001";

    for (index = 0; index < MAX_VECTORS; index++) {
        // 施加向量
        clear = (sc_bit) in_vector[index][12];
        left_in = (sc_bit) in_vector[index][11];
        right_in = (sc_bit) in_vector[index][10];
        sel_op = (sc_bv<SEL_WIDTH>) in_vector[index].range(9, 8);
        data_in = (sc_bv<WIDTH>) in_vector[index].range(7, 4);
        expected = (sc_bv<WIDTH>) in_vector[index].range(3, 0);

        // 等待一段时间
        wait(5, SC_NS);

        // 检查输出是否正确
        if (actual_out != expected) {
            cout << "***Mismatch at time " << sc_time_stamp << " with vector at index " << index << endl;
        }

        sc_stop(); // 完成
    }
}